using System.Collections;
using System.Collections.Generic;
using Entitas;
using UnityEngine;

/// <summary>
/// 运动完成的响应系统
/// </summary>
public class MoveCompleteSystem : ReactiveSystem<GameEntity>
{
    public MoveCompleteSystem(Contexts contexts) : base(contexts.game)
    {
    }

    protected override ICollector<GameEntity> GetTrigger(IContext<GameEntity> context)
    {
        return context.CreateCollector(GameMatcher.MoveComplete);
    }

    protected override bool Filter(GameEntity entity)
    {
        return entity.isMoveComplete;
    }

    protected override void Execute(List<GameEntity> entities)
    {
        foreach (var entity in entities)
        {
            entity.isGetSameColor = true;
            entity.isMoveComplete = false;
        }
    }
}